/**
 * 优惠券相关类型定义
 */

// 优惠券状态枚举
export enum CouponStatus {
  UNUSED = 0,     // 未使用
  USED = 1,       // 已使用
  EXPIRED = 2,    // 已过期
}

// 优惠券类型枚举
export enum CouponType {
  CASH = 1,       // 现金券
  DISCOUNT = 2,   // 折扣券
  GIFT = 3,       // 礼品券
}

// 优惠券信息
export interface Coupon {
  couponId: number;
  couponCode: string;
  customerId: number;
  couponType: number;
  discountAmount?: number;
  discountRate?: number;
  minOrderAmount: number;
  maxDiscountAmount?: number;
  usageScope: string;
  validFrom: string;
  validUntil: string;
  status: number;
  usedAt?: string;
  orderId?: number;
  description?: string;
}

// 优惠券统计
export interface CouponStats {
  totalCount: number;
  unusedCount: number;
  usedCount: number;
  expiredCount: number;
}

// 优惠券使用请求
export interface UseCouponRequest {
  couponCode: string;
  orderId: number;
}

// 兑换优惠券请求
export interface RedeemCouponRequest {
  exchangeCode: string;
}

// 优惠券状态映射
export const COUPON_STATUS_MAP: Record<number, string> = {
  [CouponStatus.UNUSED]: '未使用',
  [CouponStatus.USED]: '已使用',
  [CouponStatus.EXPIRED]: '已过期',
};

// 优惠券类型映射
export const COUPON_TYPE_MAP: Record<number, string> = {
  [CouponType.CASH]: '现金券',
  [CouponType.DISCOUNT]: '折扣券',
  [CouponType.GIFT]: '礼品券',
};